﻿using ServiceStack.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace unvsAPI
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            JsConfig<DateTime>.RawSerializeFn = t => "new Date(" + t.Year+ ","+(t.Month-1)+","+t.Day+","+t.Hour+","+t.Minute+","+t.Second+")";
            JsConfig<DateTime?>.RawSerializeFn=t=>((t==null)?"null":"new Date(" + t.Value.Year+ ","+(t.Value.Month-1)+","+t.Value.Day+","+t.Value.Hour+","+t.Value.Minute+","+t.Value.Second+")");
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
    }
}